/**
 * 
 */
package com.antilia.infomaresme.pages;

import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.markup.html.panel.Panel;

/**
 * @author Ernesto
 *
 */
public class ContextPanel extends Panel {

	private static final long serialVersionUID = 1L;

	public static String CONTENT_ID = "context";
	
	private Panel contents;
	
	/**
	 * @param id
	 */
	public ContextPanel(String id) {
		super(id);
		setOutputMarkupId(true);
	}
	
	@Override
	protected void onBeforeRender() {
		if(getContents() == null) {
			contents = new EmptyPanel(CONTENT_ID);
			add(contents);
		}
		super.onBeforeRender();
	}

	public Panel getContents() {
		return contents;
	}

	public void setContents(Panel contents) {
		addOrReplace(contents);
		this.contents = contents;
	}

}
